package com.ciba.demo.controller;

import com.ciba.demo.respone.ApiRestResponse;
import com.ciba.demo.service.PlanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller
public class PlanController {
    @Autowired
    PlanService planService ;

    @GetMapping("/getPlan")
    @ResponseBody
    ApiRestResponse getPlan(HttpServletRequest request, HttpServletResponse response){
        return planService.getPlan(request,response) ;
    }

    @PostMapping("/changePlan")
    @ResponseBody
    ApiRestResponse changePlan(HttpServletRequest request , HttpServletResponse response){
        return planService.setPlan(request,response) ;
    }

    @GetMapping("/getPlans")
    @ResponseBody
    ApiRestResponse getPlans(HttpServletRequest request,HttpServletResponse response){
        return planService.getPlans(request,response) ;
    }

    @PostMapping("/addPlan")
    @ResponseBody
    ApiRestResponse addPlan(HttpServletRequest request,HttpServletResponse response){
        return planService.addPlan(request,response) ;
    }
}
